package com.leyou.item.mapper;

import com.leyou.common.base.BaseMapper;
import com.leyou.item.pojo.Sku;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.special.InsertListMapper;

public interface SkuMapper extends BaseMapper<Sku>,InsertListMapper<Sku>{

    @Update("update tb_sku set stock=stock-#{num} where id=#{skuId}")
    int updateStock(@Param("skuId") Long skuId,@Param("num") Integer num);

    @Update("update tb_sku set stock=stock+#{num} where id=#{skuId}")
    int plusStock(@Param("skuId") Long skuId,@Param("num") Integer num);
}
